﻿using MenusHunter.WinRT.Core.Services.Photo;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Collections.ObjectModel;

namespace MenusHunter.WinRT.Core.Models
{
    public class PhotosManager
    {
        public static async Task<ObservableCollection<Photo>> GetListPhotoRestaurant(int restaurantId)
        {
            var client = new PhotosManager1SoapClient();

            var response = await client.GetListPhotoRestaurantAsync(restaurantId);

            return response.Body.GetListPhotoRestaurantResult;
        }

        public static async Task<int> NewPhoto(Photo photo)
        {
            var client = new PhotosManager1SoapClient();

            var response = await client.NewPhotoAsync(photo.RestaurantId, photo.Url, photo.UrlThumb, photo.Status);

            return response.Body.NewPhotoResult;
        }

        public static async Task<bool>  DeletePhoto(int photoId)
        {
            var client = new PhotosManager1SoapClient();

            var response = await client.DeletePhotoAsync(photoId);

            return response;
        }
    }
}
